package com.jic.member.controller.manage;

import com.jic.common.base.vo.PageResult;
import com.jic.common.base.vo.RestResult;
import com.jic.member.request.MemDiscountCardPeriodRequest;
import com.jic.member.request.MemDiscountThemeRequest;
import com.jic.member.response.MemDiscountCardPeriodResponse;
import com.jic.member.response.MemDiscountThemeResponse;
import com.jic.member.service.MemDiscountCardPeriodService;
import com.jic.member.service.MemDiscountThemeService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Slf4j
@RestController
@RequestMapping("/memDiscountTheme")
public class MemDiscountThemeController {

    @Resource
    MemDiscountThemeService memDiscountThemeService;

    @Resource
    MemDiscountCardPeriodService memDiscountCardPeriodService;



    /*
     * 分页查询
     * */
    @ApiOperation(value = "获取折扣卡主题所有列表")
    @ResponseBody
    @RequestMapping("/queryDiscountThemeList")
    public RestResult<PageResult<MemDiscountThemeResponse>> queryDiscountThemeList(@RequestBody MemDiscountThemeRequest request) {
        return RestResult.success(memDiscountThemeService.queryDiscountThemeList(request));
    }


    /*
     * 获取折扣卡主题基本信息
     * */
    @ApiOperation(value = "获取折扣卡主题基本信息")
    @ResponseBody
    @RequestMapping("/queryDiscountThemeInfo")
    public RestResult<MemDiscountThemeResponse> queryDiscountThemeInfo(@RequestBody MemDiscountThemeRequest request) {
        return RestResult.success(memDiscountThemeService.queryDiscountThemeInfo(request));
    }


    /*
     * 获取折扣卡主题基本信息
     * */
    @ApiOperation(value = "新增/更新 折扣卡主题基本信息")
    @ResponseBody
    @RequestMapping("/createDiscountTheme")
    public RestResult<Long> createDiscountTheme(@RequestBody MemDiscountThemeRequest request) {
        return RestResult.success(memDiscountThemeService.createDiscountTheme(request));
    }

    /*
     * 获取折扣卡主题基本信息
     * */
    @ApiOperation(value = "删除 折扣卡主题基本信息")
    @ResponseBody
    @RequestMapping("/deleteDiscountTheme")
    public RestResult<Long> deleteDiscountTheme(@RequestBody MemDiscountThemeRequest request) {
        return RestResult.success(memDiscountThemeService.deleteDiscountTheme(request));
    }


    /**
     * 获取生卡/绑卡批次记录
     * @param request
     * @return
     */
    @ApiOperation(value = "获取生卡/绑卡批次记录")
    @ResponseBody
    @RequestMapping("/queryDiscountCardPeriodList")
    public RestResult<PageResult<MemDiscountCardPeriodResponse>> queryDiscountCardPeriodList(@RequestBody MemDiscountCardPeriodRequest request) {
        return RestResult.success(memDiscountCardPeriodService.queryDiscountCardPeriodList(request));
    }
}
